import Vue from 'vue';
import VueRouter, { RouteConfig } from 'vue-router';

Vue.use(VueRouter);

const routes: Array<RouteConfig> = [
    {
        path: '*',
        redirect: '/home'
    },
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/initialize',
        name: 'initialize',
        component: () => import('../views/init/index.vue')
    },
    {
        path: '/home',
        name: 'home',
        component: () => import('../views/home/index.vue')
    }
];
const BASE_URL = process.env.NODE_ENV === 'production' ? '/' : '/';
const router = new VueRouter({
    mode: 'history',
    base: BASE_URL,
    routes
});
// router.beforeEach((to, from, next) => {
//     if (to.path !== '/initialize' && !sessionStorage.getItem('INIT_SUCCESS')) {
//         router.replace('/initialize');
//     }
//     next();
// });
export default router;
